package com.example.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.example.domain.entity.Article;
import com.example.domain.entity.Product;
import org.apache.ibatis.annotations.*;

@Mapper
public interface ProductMapper extends BaseMapper<Product> {
//    @Select("select distinct p.*,pc.name as productCategoryName"  +
//            " from product p" +
//            " left join product_category pc on p.categoryId;=pc.id" +
//            " ${ew.customSqlSegment}")
//    @Results({@Result(id = true, property = "productCategoryName",column = "productCategoryName")})
//    public IPage<Product> getProductPage(IPage<Product> page, @Param(Constants.WRAPPER) QueryWrapper<Product> qw);
    @Select("select distinct * from product ${ew.customSqlSegment}")
    public IPage<Product> getProductPage(IPage<Product> page, @Param(Constants.WRAPPER) QueryWrapper<Product> qw);
}
